package com.fenqing.leetcode.code.t300_400;

import cn.hutool.json.JSONUtil;
import com.fenqing.annotations.Execute;
import com.fenqing.core.Topic;

/**
 * @author fenqing
 */
public class Topic344 extends Topic {
    /**
     * 构造器
     *
     * @param input 输入
     */
    public Topic344(String input) {
        super(input);
    }

    @Execute(voidReturnIndex = 0)
    public void reverseString(char[] s) {
        int p = 0, q = s.length - 1;
        while (p < q) {
            char temp  = s[p];
            s[p] = s[q];
            s[q] = temp;
            p++;
            q--;
        }
    }

    public static void main(String[] args) {
        Topic344 topic = new Topic344("['a', 'b', 'c', 'd']");
        topic.run();
        char[] chars = topic.getObject(0);
        System.out.println(JSONUtil.toJsonStr(chars));
    }
}
